home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1999 March
/
EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso
/
earcd
/
devel
/
vbcc-wos
/
machines
/
amigawos
/
include
/
string.h
< prev
next >
Wrap
C/C++ Source or Header
|
1999-01-01
|
3KB
|
85 lines
/* string.h - vbcc PowerOpen/WarpOS */
#ifndef __STRING_H
#define __STRING_H 1
#ifndef __SIZE_T
#define __SIZE_T 1
typedef unsigned long size_t;
#endif
#undef NULL
#define NULL ((void *)0)
void *memcpy(void *s1,const void *s2,size_t n);
void *memmove(void *,const void *,size_t);
void *memset(void *,int,size_t);
int memcmp(const void *,const void *,size_t);
void *memchr(const void *,int,size_t);
char *strcat(char *,const char *);
char *strncat(char *,const char *,size_t);
char *strchr(const char *,int);
size_t strcspn(const char *,const char *);
char *strpbrk(const char *,const char *);
char *strrchr(const char *,int);
size_t strspn(const char *,const char *);
char *strstr(const char *,const char *);
char *strtok(char *,const char *);
char *strerror(int);
/* PowerPC inline functions */
size_t strlen(__reg("r3") const char *) =
"\tsubi\tr4,r3,1\n"
"#barrier\n"
"\tlbzu\t0,1(r4)\n"
"\tcmpwi\tr0,0\n"
"\tbne\t$-8\n"
"\tsub\tr3,r4,r3";
char *strcpy(__reg("r3") char *, __reg("r4") const char *) =
"\tsubi\tr5,r3,1\n"
"\tsubi\tr4,r4,1\n"
"#barrier\n"
"\tlbzu\t0,1(r4)\n"
"\tstbu\t0,1(r5)\n"
"\tcmpwi\tr0,0\n"
"\tbne\t$-12";
char *strncpy(__reg("r3") char *, __reg("r4") const char *,
__reg("r5") size_t) =
"\tcmpwi\tr5,0\n"
"\tbeq\t$+36\n"
"\tmtctr\tr5\n"
"\tsubi\tr5,r3,1\n"
"#barrier\n"
"\tlbz\tr0,0(r4)\n"
"\tstbu\tr0,1(r5)\n"
"\tcmpwi\tr0,0\n"
"\tbeq\t$+8\n"
"\taddi\tr4,r4,1\n"
"\tbdnz\t$-20";
int strcmp(__reg("r3") const char *, __reg("r4") const char *) =
"\tsubi\tr5,r3,1\n"
"\tsubi\tr4,r4,1\n"
"#barrier\n"
"\tlbzu\tr3,1(r5)\n"
"\tlbzu\tr6,1(r4)\n"
"\tsub.\tr3,r3,r6\n"
"\tbne\t$+12\n"
"\tcmpwi\tr6,0\n"
"\tbne\t$-20";
int strncmp(__reg("r3") const char *, __reg("r4") const char *,
__reg("r5") size_t) =
"\tsubi\tr6,r3,1\n"
"\tli\tr3,0\n"
"\tcmpwi\tr5,0\n"
"\tbeq\t$+36\n"
"\tsubi\tr4,r4,1\n"
"\tmtctr\tr5\n"
"#barrier\n"
"\tlbzu\tr3,1(r6)\n"
"\tlbzu\tr5,1(r4)\n"
"\tsub.\tr3,r3,r5\n"
"\tbne\t$+12\n"
"\tcmpwi\tr5,0\n"
"\tbdnzf\t2,$-20";
#endif